import { kgjHttp as http } from '@/services/http';
import type { ListResult, Limit } from '@/types/api/common';
import type { StatisticsCore, StatisticsTrend, LecturerListParamsDTO, LecturerBindListParamsDTO,
  LecturerCosListParamsDTO, LecturerSingleStatParamsDTO, LecturerPromoteParamsDTO, LecturerDiscountParamsDTO,
  LecturerParamsDTO, LecturerExchangeParamsDTO, LecturerCashAuditParamsDTO, LecturerDiscountDelParamsDTO } from '@/types/api/crm-agency/lecturer';
// 全部讲师列表（考古加+大赢加）
export const getLecAllList = (payload: { data: LecturerListParamsDTO; params: Limit }) =>
  http<ListResult<any>>({
    method: 'post',
    url: '/api/lec/alllist',
    ...payload
  });
// 讲师列表
export const getLecList = (payload: { data: LecturerListParamsDTO; params?: Limit }) =>
  http({
    method: 'post',
    url: '/api/lec/list',
    ...payload
  });
/** 停用推广链接 */
export const updateLecPromoteLink = (payload: {data: {extend_id: number; invalid_time: number}}) =>
  http({
    method: 'post',
    url: '/api/lec/extend/edit',
    ...payload
  });
/** 停用推广链接 */
export const stopLecPromoteLink = (payload: {data: {extend_id: number}}) =>
  http({
    method: 'post',
    url: '/api/lec/extend/stop',
    ...payload
  });
// 结算列表
export const getLecCashList = (payload: { data: LecturerListParamsDTO; params: Limit }) =>
  http<ListResult<any>>({
    method: 'post',
    url: '/api/lec/cash/list',
    ...payload
  });
// 跟进人筛选
// GET/api/lec/statistics/follower
export const lecFollower = () =>
  http({
    method: 'get',
    url: '/api/lec/statistics/follower'
  });
// 新增讲师
export const lecAdd = (data: LecturerParamsDTO) =>
  http({
    method: 'post',
    url: '/api/lec/add',
    data
  });

// 编辑讲师
export const lecEdit = (data: LecturerParamsDTO) =>
  http({
    method: 'post',
    url: '/api/lec/edit',
    data
  });
// 重置密码
// GET/api/lec/reset/pws
// params
export const lecResetPws = (params: LecturerParamsDTO) =>
  http({
    method: 'get',
    url: '/api/lec/reset/pws',
    params
  });

// 今日统计
// GET/api/lec/statistics/core
// params
// channel
export const lecStatisticsCore = (params: StatisticsCore) =>
  http({
    method: 'get',
    url: '/api/lec/statistics/core',
    params
  });

// 趋势图
// GET/api/lec/statistics/trend
// channel
// type 1. 累积用户 2. 新增用户 3. 成交 4. 订单 5. 活跃 6. 转化 7. 客单价
// fromDt
// toDt
export const lecStatisticsTrend = (params: StatisticsTrend) =>
  http({
    method: 'get',
    url: '/api/lec/statistics/trend',
    params
  });

// 绑定列表
export const getLecBindList = (payload: { data: LecturerBindListParamsDTO; params: Limit }) =>
  http<ListResult<any>>({
    method: 'post',
    url: '/api/lec/bind/list',
    ...payload
  });
// 佣金列表
export const getLecCosList = (payload: { data: LecturerCosListParamsDTO; params: Limit }) =>
  http<ListResult<any>>({
    method: 'post',
    url: '/api/lec/cos/list',
    ...payload
  });
// 单个讲师兑换码统计
export const getLecSingleStat = (params:LecturerSingleStatParamsDTO) =>
  http({
    method: 'get',
    url: '/api/lec/single/stat',
    params
  });
  // 讲师兑换批次使用情况
export const getLecBatchList = (payload: { data: LecturerSingleStatParamsDTO }) =>
  http<ListResult<any>>({
    method: 'get',
    url: '/api/lec/batch/list',
    params: payload.data
  });
// 清空渠道码批次
export const channelAll = (params: LecturerExchangeParamsDTO) =>
  http({
    method: 'get',
    url: '/api/lec/clear/channel',
    params
  });
// 清空兑换码批次
export const batchAll = (params: LecturerExchangeParamsDTO) =>
  http({
    method: 'get',
    url: '/api/lec/clear/batch',
    params
  });
// 更新渠道码
export const updateChannel = (data:LecturerExchangeParamsDTO) =>
  http({
    method: 'post',
    url: '/api/lec/update/channel',
    data
  });
// 打款审核
export const cashAudit = (data:LecturerCashAuditParamsDTO) =>
  http({
    method: 'post',
    url: '/api/lec/cash/audit',
    data
  });
// 清空
export const lecClear = (params:LecturerListParamsDTO) =>
  http({
    method: 'get',
    url: '/api/lec/clear',
    params
  });
// 生成渠道码
export const genChannel = (data: LecturerListParamsDTO) =>
  http({
    method: 'post',
    url: '/api/lec/genchannel',
    data
  });
/** 考古加 - 发放推广链接 */
export const genPromoteLink = (data: LecturerListParamsDTO) => {
  return http({
    method: 'post',
    url: '/api/lec/extend',
    data
  });
};
/** 考古加 - 获取推广链接列表 */
export const getPromoteLinkList = (payload: { data: LecturerPromoteParamsDTO; params: Limit }) => {
  return http({
    method: 'post',
    url: '/api/lec/extendurl/list',
    ...payload
  });
};
/** 考古加 - 获取推广列表 */
export const getPromotionList = (payload: { data: LecturerPromoteParamsDTO; params: Limit }) => {
  return http({
    method: 'post',
    url: '/api/lec/extend/list',
    ...payload
  });
};
/** 考古加 - 折扣活动列表 */
export const getDiscountList = (payload: { data: LecturerPromoteParamsDTO; params: Limit }) => {
  return http({
    method: 'post',
    url: '/api/lec/discount/list',
    ...payload
  });
};
/** 考古加 - 删除折扣活动 */
export const delDiscount = (params:LecturerDiscountDelParamsDTO) => {
  return http({
    method: 'get',
    url: '/api/lec/discount/delete',
    params
  });
};
/** 考古加 - 添加折扣活动 */
export const addDiscount = (data: LecturerDiscountParamsDTO) => {
  return http({
    method: 'post',
    url: '/api/lec/discount/add',
    data
  });
};
/** 考古加 - 更新折扣活动 */
export const updateDiscount = (data: LecturerDiscountParamsDTO) => {
  return http({
    method: 'post',
    url: '/api/lec/discount/edit',
    data
  });
};
